package bbs.mvc.Servlet;

import bbs.mvc.Beans.DBUtils;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet(name = "delete-s",value = "/delete-servlet")
public class DeletServlet extends HttpServlet {
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
        String id = request.getParameter("id");
        System.out.println(id);
        try {
            DBUtils.deleteblog(id);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        response.sendRedirect("./admin/admin.jsp");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {

        this.doGet(request, response);
    }
}

